<?php
namespace app\validate;
use think\Validate;

class NewValidate extends Validate
{
    //定义验证规则
    protected  $rule=[
        'title'=>'require',
        'look_num'=>'require|integer',
        'abstract'=>'require',
        'content'=>'require',
        'author'=>'require',
    ];
    //定义验证失败时的提示信息
    protected $message = [
        'title.require'=>'标题不能为空',
        'author.require'=>'作者不能为空',
        // ......
    ];
    //验证场景
    protected $scene=[
        'add'=>['title','author'],
        'edit'=>['id','title','author'],
    ];
}